#!/usr/bin/python3
# -*- coding: utf8 -*-
# Date   : 2023/04/28
# Author : Kwan
# Email  : allenxian@live.com
# Blog   : https://my.oschina.net/kwanxian

from fastapi import FastAPI
from validator import faster_validate

app = FastAPI()

@app.get("/api")
def api():
    return {"message": "Hello World"}

@app.get("/api/user")
@faster_validate(sub="user", obj="/api/user", act="GET")
def get_user_role():
    return {"role": "user"}


if __name__ == "__main__":
    import uvicorn

    uvicorn.run(app="faster:app", host="localhost", port=8000)